package xiaolicarrental.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import xiaolicarrental.model.Car;

import java.util.List;

@Mapper
public interface CarMapper {
    @Select("select * from vehicle")
    List<Car> list();

    @Select("select * from vehicle where id = #{id}")
    Car getById(Integer id);

    @Insert("insert into vehicle (model, plate, status, daily_price) values (#{model}, #{plate}, #{status}, #{dailyPrice})")
    void add(Car car);

    @Insert("delete from vehicle where id = #{id}")
    void deleteById(Integer id);


}
